﻿Imports System.Data


Public Class popup_Outlet

    Private Sub popup_Outlet_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        dg_Outlet.DataSource = PublicVariables.dt_Outlet
    End Sub

    Private Sub createData()
        'dt = New DataTable
        'dt.Columns.Add("oltCode")
        'dt.Columns.Add("oltName")
        'Dim dr As DataRow
        'dr = dt.NewRow
        'dr("oltCode") = "A0001"
        'dr("oltName") = "Shop Ben Thanh"
        'dt.Rows.Add(dr)

        'dr = dt.NewRow
        'dr("oltCode") = "A0002"
        'dr("oltName") = "Russian Market"
        'dt.Rows.Add(dr)

        'dr = dt.NewRow
        'dr("oltCode") = "A0002"
        'dr("oltName") = "Shop Nguyen D. Chieu"
        'dt.Rows.Add(dr)

        'dr = dt.NewRow
        'dr("oltCode") = "A0003"
        'dr("oltName") = "Shop Vincom"
        'dt.Rows.Add(dr)

        'dr = dt.NewRow
        'dr("oltCode") = "A0004"
        'dr("oltName") = "Shop Diamond Plaza"
        'dt.Rows.Add(dr)
    End Sub

    Private Sub btn_Ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Ok.Click
        Me.DialogResult = Windows.Forms.DialogResult.OK
    End Sub

    Private Sub dg_Outlet_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dg_Outlet.MouseUp
        If dg_Outlet.CurrentRowIndex <> 0 Then
            dg_Outlet.Select(dg_Outlet.CurrentRowIndex)
        End If
    End Sub

    Private Sub txt_Filter_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt_Filter.TextChanged
        Dim strName As String
        strName = txt_Filter.Text

        Dim drs As DataRow() = PublicVariables.dt_Outlet.Select("CardName like '%" & strName & "%'")
        If drs.Length > 0 Then
            dg_Outlet.DataSource = drs.CopyToDataTable()
        Else
            'dg_Outlet.
        End If

    End Sub
End Class